package heliotrope.net.loader
{
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import flash.media.SoundTransform;
	import heliotrope.global.ErrorHandler;
	public class SoundTarget implements ILoadTarget
	{
		private var _sound:Sound;
		public function SoundTarget()
		{
		}
		
		public function saveData(data_:Object):void
		{
			CONFIG::debug
			{
				try
				{
					if(!(data_ is Sound)) throw new ArgumentError("Wrong data type to save");
					_sound = data_ as Sound;
				} 
				catch(error:ArgumentError) 
				{
					ErrorHandler.handle(error);
				}
			}
		}
		
		public function play(startTime:Number = 0, loops:int = 0, sndTransform:SoundTransform = null):SoundChannel
		{
			return _sound.play(startTime, loops, sndTransform);
		}
	}
}